<?
include "../include/database.php";

/*
Module: betaling
Version: 1.0
Writed by: Barth Steeg


This module add,delete and edit a invoice.
*/

class cls_betaling
{	
	public function add($_klantid, $_artikelid, $_bedrag, $_status, $_begindatum, $_einddatum, $_opzeggen, $_aantal) 
	{
		//calculate amount to pay.
		
		if($_bedrag != '')
		{
			$bedrag = $_bedrag * $_aantal;
		}
		else
		{
			echo "no amount of money !";
		}
		
		if($_klantid != '' || $_artikelid != '' || $_bedrag != ''
		   $_status != '' || $_begindatum != '' || $_einddatum != ''
		   $_opzeggen != '' || $_aantal != '')
		{
			mysql_query("INSERT INTO factuur (klantid, artikelid, bedrag) 
			VALUES('".$_omschrijving."', '".$_bedrag."', '".$_idsub."')");
		}
		else
		{
			echo "There is no input in this function!";
		}
	}
	
	public function delete($_id) 
	{
		if($_id != '')
		{
			mysql_query("DELETE FROM factuur WHERE id = '". $_id ."'");
		}
		else
		{
			echo "There is no input in this function!";
		}
	}
	
	public function edit($_id)
	{
	}
	
	public function setpaid($_id)
	{
	}

}